import {useLocation,useParams} from 'umi';
import { UserAPI } from '@/utils';
function UserDetail(){
    let location = useLocation();
    const params = useParams();
    //路径对象的状态属性就是从列表页传递过的路径状态
    let user = location.state;
    if(!user){
        user=UserAPI.find(Number(params.id));
    }
    return (
     <div>
        <p>ID:{user.id}</p>
        <p>username:{user.username}</p>
     </div>
    )
}
export default UserDetail;